package cn.tedu._03vehicle.pojo.dto;

import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.Email;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Pattern;
import jakarta.validation.constraints.Size;
import lombok.Data;

@Data
public class UserRegParam {
	//@NotNull(message = "用户名不能为null")
	//@NotEmpty(message = "用户名不能为null和空字符串")
	//@NotBlank(message = "用户名不能为null和空字符串和空白串")
	//@Size(min = 3, max = 10, message = "用户名长度必须在3-10之间")
	@Pattern(regexp = "^(?:[\\u4e00-\\u9fa5]{1,7}|[a-zA-Z]{1,14})$",
			message = "用户名必须为1-7个汉字或1-14个英文字母")
	@Schema(description = "用户名", required = true, example = "admin")
	private String username;
	@Pattern(regexp = "^(?!.*\\s)(?!.*[\\u4e00-\\u9fa5])(?=.*[a-zA-Z\\d])(?=.*[\\p{P}\\p{S}])[\\x21-\\x7E]{8,14}$|" +
			"^(?!.*\\s)(?!.*[\\u4e00-\\u9fa5])(?=.*[a-zA-Z])(?=.*\\d)[\\x21-\\x7E]{8,14}$|" +
			"^(?!.*\\s)(?!.*[\\u4e00-\\u9fa5])(?=.*[\\p{P}\\p{S}])(?=.*\\d)[\\x21-\\x7E]{8,14}$",
			message = "密码必须为8-14个字符，包含字母、数字和标点符号中的至少两种，且不能有空格或中文")
	@Schema(description = "密码", required = true, example = "123456")
	private String password;
	@Pattern(regexp = "^[a-zA-Z0-9][a-zA-Z0-9_-]*(\\.[a-zA-Z0-9_-]+)*@([a-zA-Z0-9-]+\\.)+(com|com\\.cn|cn|net|org|gov\\.cn|edu\\.cn|mil\\.cn)$",
			message = "邮箱格式不正确，请使用有效的中国大陆邮箱")
	@Email(message = "邮箱格式错误")
	@Schema(description = "邮箱", required = true, example = "admin@163.com")
	private String email;
	@Pattern(regexp = "^1(3[0-9]|4[5-9]|5[0-35-9]|6[2567]|7[0-8]|8[0-9]|9[0-35-9])\\d{8}$",
			message = "手机号格式不正确，请输入中国大陆合法的手机号码")
	@Schema(description = "手机号码", required = true, example = "13888888888")
	private String phone;
}
